package configuration.dataObjects
{
	import common.utils.DateManager;
	
	import mx.collections.ArrayCollection;
	[Bindable]
	public class ItemUnitOfMeasureDO
	{
		public var INTERNAL_ITEM_UM:String = "0";
		public var ITEM:String = "";
		public var COMPANY:String = "";
		public var SEQUENCE:String = "1";
		public var QUANTITY_UM:String = "";
		public var CONVERSION_QTY:String = "0";
		public var LENGTH:String = "0";
		public var WIDTH:String = "0";
		public var HEIGHT:String = "0";
		public var DIMENSION_UM:String = "";
		public var WEIGHT:String = "0";
		public var WEIGHT_UM:String = "0";
		public var USER_DEF1:String = "";
		public var USER_DEF2:String = "";
		public var USER_DEF3:String = "";
		public var USER_DEF4:String = "";
		public var USER_DEF5:String = "";
		public var USER_DEF6:String = "";
		public var USER_DEF7:String = "0";
		public var USER_DEF8:String = "0";
		public var USER_STAMP:String = "";
		public var PROCESS_STAMP:String = "";
		public var DATE_TIME_STAMP:String = DateManager.GetTodayString();
		public var TREAT_FULL_PCT:String = "100";
		public var MOVEMENT_CLS:String = "";
		public var ITEM_CLASS:String = "";
		public var TREAT_AS_LOOSE:String = "Y";
		public var GROUP_DURING_CHECKIN:String = "Y";
		
		public function ItemUnitOfMeasureDO()
		{
		}

		public function Init(xmlObj:XML):void{
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
			<ITEM_UNIT_OF_MEASURE>
				<INTERNAL_ITEM_UM>{INTERNAL_ITEM_UM}</INTERNAL_ITEM_UM>
				<ITEM>{ITEM}</ITEM>
				<COMPANY>{COMPANY}</COMPANY>
				<SEQUENCE>{SEQUENCE}</SEQUENCE>
				<QUANTITY_UM>{QUANTITY_UM}</QUANTITY_UM>
				<CONVERSION_QTY>{CONVERSION_QTY}</CONVERSION_QTY>
				<LENGTH>{LENGTH}</LENGTH>
				<WIDTH>{WIDTH}</WIDTH>
				<HEIGHT>{HEIGHT}</HEIGHT>
				<DIMENSION_UM>{DIMENSION_UM}</DIMENSION_UM>
				<WEIGHT>{WEIGHT}</WEIGHT>
				<WEIGHT_UM>{WEIGHT_UM}</WEIGHT_UM>
				<USER_DEF1>{USER_DEF1}</USER_DEF1>
				<USER_DEF2>{USER_DEF2}</USER_DEF2>
				<USER_DEF3>{USER_DEF3}</USER_DEF3>
				<USER_DEF4>{USER_DEF4}</USER_DEF4>
				<USER_DEF5>{USER_DEF5}</USER_DEF5>
				<USER_DEF6>{USER_DEF6}</USER_DEF6>
				<USER_DEF7>{USER_DEF7}</USER_DEF7>
				<USER_DEF8>{USER_DEF8}</USER_DEF8>
				<USER_STAMP>{USER_STAMP}</USER_STAMP>
				<PROCESS_STAMP>{PROCESS_STAMP}</PROCESS_STAMP>
				<DATE_TIME_STAMP>{DATE_TIME_STAMP}</DATE_TIME_STAMP>
				<TREAT_FULL_PCT>{TREAT_FULL_PCT}</TREAT_FULL_PCT>
				<MOVEMENT_CLS>{MOVEMENT_CLS}</MOVEMENT_CLS>
				<ITEM_CLASS>{ITEM_CLASS}</ITEM_CLASS>
				<TREAT_AS_LOOSE>{TREAT_AS_LOOSE}</TREAT_AS_LOOSE>		
				<GROUP_DURING_CHECKIN>{GROUP_DURING_CHECKIN}</GROUP_DURING_CHECKIN>
			</ITEM_UNIT_OF_MEASURE>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:ItemUnitOfMeasureDO = new ItemUnitOfMeasureDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}

	}
}